echoing url to xml output

echoing url to xml output

am 19.12.2007 13:18:52 von IT

Hi

I am creating an XML output using php but get a error because the data
in the description field is outputing a link which is: Paste the wall.

Below is the script I'm using, new to php and not sure how to get
round this hope someone can help. Thanks in advance..........

$dbhost = '';
$dbuser = '';
$dbpass = '';
$dbname = '';
mysql_connect($dbhost, $dbuser, $dbpass) or die("I could not connect
to database");
mysql_select_db($dbname) or die (mysql_error());
header('Content-type: text/xml');
echo '';
echo '
xsi:nonamespaceschemalocation="schema">';
// Start the XML
$data = mysql_query("select * from products ORDER BY description");
while($row = mysql_fetch_array($data))
{
echo '

';
}
echo '
';
?>

Re: echoing url to xml output

am 19.12.2007 18:04:49 von Erwin Moller

it@brewers.co.uk wrote:
> Hi

Hi,

> I am creating an XML output using php but get a error because the data
> in the description field is outputing a link which is: Paste the wall.

You get an error.
What error?
Where?
In PHP or with the xml-output when you try to parse it somewhere else?

A blind guess would be: You get an error in the produced XML, since it
produces:



which gives:



That doesn't make a lot of sense.
It is a very strange id: "Paste the wall"

I don't know the first thing about XML, but I expect this to be nonsense.

If an id in XML is anything like an id in html, it cannot contain
spaces, or <

Regards,
Erwin Moller

>
> Below is the script I'm using, new to php and not sure how to get
> round this hope someone can help. Thanks in advance..........
>
> > $dbhost = '';
> $dbuser = '';
> $dbpass = '';
> $dbname = '';
> mysql_connect($dbhost, $dbuser, $dbpass) or die("I could not connect
> to database");
> mysql_select_db($dbname) or die (mysql_error());
> header('Content-type: text/xml');
> echo '';
> echo '
> > xsi:nonamespaceschemalocation="schema">';
> // Start the XML
> $data = mysql_query("select * from products ORDER BY description");
> while($row = mysql_fetch_array($data))
> {
> echo '
>
>
';
> }
> echo '
>
';
> ?>

Re: echoing url to xml output

am 20.12.2007 11:01:42 von Toby A Inkster

it wrote:

> echo '
>
>
';

echo '

';

Also, for what it's worth...

> select * from products ORDER BY description

select description from products ORDER BY description

ought to be faster.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 12 days, 20:36.]

Sharing Music with Apple iTunes
http://tobyinkster.co.uk/blog/2007/11/28/itunes-sharing/